/*
 * flash.h
 *
 *  Created on: Aug 5, 2019
 *      Author: duan
 */

#ifndef FLASH_H_
#define FLASH_H_

#define SPI_DEVICE_ID			   XPAR_SPI_0_DEVICE_ID
#define SPI_FLASH_SLAVE_SELECT	   1

extern uint32_t fl_addr;
extern int      srec_line;
#define CR      13

/* Declarations */
void    flash_init();
uint8_t load_exec ();
uint8_t load_mem (uint8_t *mem_ptr);
int     spi_flash_read(uint32_t* FlashAddress,uint32_t ByteCount);
void    flash_page_write(uint32_t* FlashAddress, uint8_t* buf);
void    flash_sector_erase(uint32_t* FlashAddress);

#endif /* FLASH_H_ */
